<!-- UserModel.php-->
<?php
	/*$basedir = dirname(dirname(dirname(__FILE__))).'/common/ConnDB.php';
	echo $basedir;*/
	/*require dirname(dirname(dirname(__FILE__))).'/common/ConnDB.php';
	require dirname(dirname(dirname(__FILE__))).'/common/config.php';*/
	require 'common/ConnDB.php';
	require 'common/config.php';
	//dirname(__FILE__) 一般会返回文件所在当前目录到系统根目录的一个目录结构。
	require 'Model.php';
	class AdminModel extends Model{
		function __Construct(){
			parent::__Construct();
		}
		function doLogin(){
      $u=$_POST["adminname"];
      $p=$_POST["adminpassword"];
      $sql="select * from admin where adminname='$u' and adminpassword='$p'";
      $rs=mysql_query($sql);
      if($rs) {
        session_start();
        $_SESSION["adminname"]=$u;
        header("location:admin.php");
      } else {
        header("location:admin.php?re=1&msg=登录失败，请重新登录");
      }
		}


	}
 ?>
